<template>
  <div class="withdrawalsAccount">
    <nav-bar title="提现账户"
             :goback="true"></nav-bar>
    <div class="header">
      <span class='text'>账户余额</span>
      <span class='price'>￥{{price}}</span>
      <button class='btn'>立即提现</button>
    </div>
    <div class="commission">
      <van-row>
        <van-col span="12"
                 class="left">
          <p>
            ￥&nbsp;{{curCommission}}
          </p>
          <span>
            当月佣金
          </span>
          <div class="border"></div>
        </van-col>
        <van-col span="12">
          <p>
            ￥&nbsp;{{hisCommission}}
          </p>
          <span>
            历史佣金
          </span>
        </van-col>
      </van-row>
      <div class="gap"></div>
    </div>
    <section class="memberList">
      <div class="title">
        <span class='text'>我的推荐</span><span class="people">（{{num}}人）</span>
      </div>
      <div>
        <van-tabs v-if="num != 0"
                  title-active-color='#06A44F'
                  v-model="active">
          <van-tab class="tab"
                   v-for="(val,key) in title"
                   :key="key"
                   :title="val">
            <div class='content'
                 v-for="(item,inex) in list"
                 :key="inex">
              <div class="img">
                <img :src="item.avator"
                     alt="">
              </div>
              <p class="name">{{item.name}}</p>
              <span class="phone">{{item.phone}}</span>
              <span class='cuommission'>当月佣金：&nbsp;￥{{item.curCommission}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;历史佣金：&nbsp;￥{{item.hisCommission}}</span>
              <span class="date">{{item.date}}</span>
            </div>
          </van-tab>
        </van-tabs>
      </div>
      <load-more :loadingType="loadingType"
      :loadEndTips='tips'
                 :isLoading="loading" />
      <div v-if="num != 0"
           class="end">暂无更多推荐~</div>
      <div v-if="num == 0"
           class="end">暂无推荐~</div>
    </section>
  </div>
</template>

<script>
import axios from 'axios'

import NavBar from "@/components/nav/navBar";
import onloadBotom from '@/components/_minxins/onBottomLoad.js'
export default {
  mixins: [onloadBotom],
  components: {
    NavBar,
  },
  data () {
    return {
      tips:'暂无更多推荐',
      active: 0,
      price: '0.00',
      curCommission: 0,
      hisCommission: 0,
      num: 0,
      title: ['全部', '会员用户', '非会员用户'],
      list: []
    }
  }, mounted () {
    this.fetch();
  },
  methods: {
    fetch () {
      this.loading = true
      axios.get("/withdrawalsList", {
        data: {
          pageIndex: this.page,
          pageSize: 10
        }
      }).then(res => {
        this.loading = false
        this.list.push(...res.data.data.rows);
        this.num = res.data.data.total;
        this.totalPages = res.data.data.totalPages
      })
      //     let params = {
      // pageIndex: this.page,
      //         pageSize: 10       
      //     }
      //     this.$fetch('/withdrawalsList', 
      //       params).then(res => {
      //       console.log(res)
      //       this.list = res.data
      //     })
    }
  }
}
</script>

<style lang='scss' scoped>
.withdrawalsAccount {
  min-height: 602px;
  background: #f5f5f7;
  * {
    background: #fff;
  }
  .header {
    background: #fff;
    margin-top: 40px;
    width: 320px;
    height: 206px;
    background: url("/static/icon/background-img/top-background.png") no-repeat;
    background-size: cover;
    text-align: center;
    span {
      display: block;
    }
    .text {
      padding-top: 43px;
      font-size: 11px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(251, 251, 251, 1);
      background: rgba(0, 0, 0, 0);
    }
    .price {
      background: rgba(0, 0, 0, 0);
      margin-top: 17px;
      font-size: 27px;
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: rgba(251, 251, 251, 1);
    }
    button {
      margin-top: 15px;
      width: 115px;
      height: 39px;
      background: rgba(251, 251, 251, 1);
      border: 1px solid rgba(255, 255, 255, 1);
      border-radius: 39px;
      font-size: 13px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(6, 164, 79, 1);
    }
  }
  .commission {
    text-align: center;
    .left {
      height: 56px;
      .border {
        position: relative;
        height: 39px;
        border-left: 1px solid #dddddd;
        top: -40px;
        left: 100%;
        width: 1px;
      }
    }
    p {
      margin: 0;
      margin-top: 13px;
      font-size: 11px;
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: rgba(51, 51, 51, 1);
    }
    span {
      font-size: 10px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
    }
  }
  .gap {
    width: 320px;
    height: 9px;
    background: #f5f5f7;
  }
  .memberList {
    .title {
      height: 47px;
      span {
        font-size: 12px;
        font-weight: 400;
        font-family: Microsoft YaHei;
        line-height: 47px;
      }
      .text {
        color: rgba(0, 0, 0, 1);
        padding-left: 5px;
        margin-left: 5px;
        border-left: 3px solid #06a44f;
      }
      .people {
        color: rgba(102, 102, 102, 1);
      }
    }

    .tab {
      font-size: 11px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(51, 51, 51, 1);
      .content {
        height: 92px;
      }
      .name {
        font-size: 12px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(0, 0, 0, 1);
        margin: 0 0 5px 68px;
        padding-top: 12px;
      }
      .phone {
        display: block;
      }
      .phone,
      .cuommission {
        font-size: 10px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
        margin: 0 0 5px 68px;
      }
      .date {
        float: right;
        position: relative;
        top: -40px;
        right: 9px;
        font-size: 9px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
      }
      .cuommission {
      }
      .img {
        float: left;
        width: 40px;
        height: 40px;
        padding: 9px 0 0 9px;
        img {
          width: 40px;
          height: 40px;
        }
      }
    }
    .end {
      background: #f5f5f7;
      text-align: center;
      padding-top: 16px;
      font-size: 11px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
    }
  }
}
</style>
<style>
.memberList .van-tabs__nav {
  width: 200px;
}
.memberList .van-tabs__nav .van-tab span {
  font-size: 11px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(51, 51, 51, 1);
}
.memberList .van-tabs__nav .van-tabs__line {
  background-color: #06a44f;
}
</style>